<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro"%>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>resources/jquery/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>resources/jquery/themes/icon.css">
<script type="text/javascript"
	src="<%=basePath%>resources/jquery/jquery.min.js"></script>
<script type="text/javascript"
	src="<%=basePath%>resources/jquery/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="<%=basePath%>resources/jquery/locale/easyui-lang-zh_CN.js"></script>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>

</head>


<body>


<div id="app">
  <p>{{ message }}</p>
</div>

<script>
new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue.js!'
  }
})
</script>



	<h1>
		<a href="/siyuan/logout.shtml">退出</a>
	</h1>
	
	<h1>
		<a href="/siyuan/home.shtml">HOME</a>
	</h1>

	<h2>${msg }</h2>
	
	

		
		<p>
		教室编号:
			<input id="classid" style="line-height:26px;border:1px solid #ccc">
		</p>
		
		匹配模式:

		<select>
			<option >模糊</option>
		</select>
		
		<p>
			<a  class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="doSearch()">查找匹配教室</a>
		</p>
	</form>


<h1>所有教室申请</h1>
<table id="dg" title="课程管理页面" class="easyui-datagrid" style="width:1300px;height:300px"
		url="/siyuan/classid_bookings.shtml"
		toolbar="#toolbar"
		rownumbers="true" fitColumns="true" singleSelect="true">
	<thead>
		<tr>
			<th field="id"" width="25">id</th>
			<th field="classUse" width="100">classUse</th>
			<th field="classid" width="50">classid</th>
			<th field="pass" width="25">pass</th>
			<th field="time" width="50">time</th>
			<th field="userid" width="25">userid</th>
			<th field="username" width="50">username</th>
			<th field="weekday" width="50">weekday</th>
		</tr>
	</thead>
</table>
<div id="toolbar">
	<a  class="easyui-linkbutton" iconCls="icon-ok" plain="true" onclick="editUser()">通过</a>
	<a  class="easyui-linkbutton" iconCls="icon-cancel" plain="true" onclick="destroyUser()">删除预定</a>
	

	<span>class ID:</span>
	<input id="classid" style="line-height:26px;border:1px solid #ccc">
	<a  class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="doSearch()">查找匹配教室</a>
</div>

<script type="text/javascript">  


function doSearch(){
	$('#dg').datagrid('load',{
		classid: $('#classid').val(),
	
	});
}



function editUser(){
    var row = $('#dg').datagrid('getSelected');
    if (row){
        $.messager.confirm('Confirm','确定通过?',function(r){
            if (r){
                $.post('/siyuan/class_pass.shtml',{id:row.id},function(result){
                    if (result = eval('1')){
                        $('#dg').datagrid('reload');    // reload the user data
                    } else {
                        $.messager.show({    // show error message
                            title: 'Error',
                            msg: result.errorMsg
                        });
                    }
                },'json');
            }
        });
    }
}



function destroyUser(){
    var row = $('#dg').datagrid('getSelected');
    if (row){
        $.messager.confirm('Confirm','确定删除?',function(r){
            if (r){
                $.post('/siyuan/delete_booking.shtml',{id:row.id},function(result){
                    if (result = eval('1')){
                        $('#dg').datagrid('reload');    // reload the user data
                    } else {
                        $.messager.show({    // show error message
                            title: 'Error',
                            msg: result.errorMsg
                        });
                    }
                },'json');
            }
        });
    }
}

</script>



</body>
</html>